package com.spddr.pmos.cxf.impl;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;

import com.spddr.pmos.cxf.JaxrsReservoir;
import com.spddr.pmos.jpa.Plant;
import com.spddr.pmos.jpa.Reservoir;
import com.spddr.pmos.repos.PlantRepos;
import com.spddr.pmos.repos.ReservoirRepos;

@Service
public class JaxrsReservoirImpl extends AbstractJaxrsObjectImpl<Reservoir> implements JaxrsReservoir {
	@Autowired
	private ReservoirRepos repository;
	@Autowired
	private PlantRepos plantRepos;

	@Override
	public JpaRepository<Reservoir, Long> getRepository() {
		return repository;
	}

	@Override
	public Collection<Plant> plants(long reservoir) {
		return plantRepos.findByReservoirId(reservoir);
	}
}
